// pages/hot/hot.js
Page({
  handleTag(e){
    this.setData({tagType:e.currentTarget.dataset.type})
    this.changeList(this.data.tagType,this.data.timeType)
  },
  hangleTime(e){
    this.setData({timeType:e.currentTarget.dataset.type})
    this.changeList(this.data.tagType,this.data.timeType)
  },
  changeList(tag,time){
    let list = []
    console.log(tag,time)
    if(tag==='war'&&time=='week'){
      list = this.data.hotData.projectWeek
    }else if(tag==='war'&&time=='month'){
      list = this.data.hotData.projectMonth
    }else if(tag==='path'&&time=='week'){
      list = this.data.hotData.pathWeek
    }else if(tag==='path'&&time=='month'){
      list = this.data.hotData.pathMonth
    }
    console.log(list)
    this.setData({renderList:list})
  },

  /**
   * 页面的初始数据
   */
  data: {
    tagType:"war",
    timeType:"week",
    renderList:[],
    hotData: {
      "projectWeek": [
        {
          "imgUrl": "https://imooc-micro-app.oss-cn-beijing.aliyuncs.com/TS.jpeg",
          "title": "前端性能优化--6大角度综合型优化方案"
        },
        {
          "imgUrl": "https://imooc-micro-app.oss-cn-beijing.aliyuncs.com/css.jpeg",
          "title": "剑指Java面试-Offer直通车"
        },
        {
          "imgUrl": "https://imooc-micro-app.oss-cn-beijing.aliyuncs.com/framework.jpeg",
          "title": "Vue2.5 开发去哪儿网App"
        },
        {
          "imgUrl": "https://imooc-micro-app.oss-cn-beijing.aliyuncs.com/graduate.jpeg",
          "title": "计算机组成原理+操作系统+计算机网络"
        },
        {
          "imgUrl": "https://imooc-micro-app.oss-cn-beijing.aliyuncs.com/ko2.jpeg",
          "title": "Spark Streaming"
        }
      ],
      "projectMonth": [
        {
          "imgUrl": "https://imooc-micro-app.oss-cn-beijing.aliyuncs.com/micro.jpeg",
          "title": "前端性能优化--6大角度综合型优化方案"
        },
        {
          "imgUrl": "https://imooc-micro-app.oss-cn-beijing.aliyuncs.com/react.jpeg",
          "title": "计算机组成原理+操作系统+计算机网络"
        },
        {
          "imgUrl": "https://imooc-micro-app.oss-cn-beijing.aliyuncs.com/scrm.jpeg",
          "title": "Vue2.5 开发去哪儿网App"
        },
        {
          "imgUrl": "https://imooc-micro-app.oss-cn-beijing.aliyuncs.com/uni-app.jpeg",
          "title": "Spark Streaming"
        },
        {
          "imgUrl": "https://imooc-micro-app.oss-cn-beijing.aliyuncs.com/vite.jpeg",
          "title": "剑指Java面试-Offer直通车"
        }
      ],
      "pathWeek": [
        {
          "imgUrl": "https://imooc-micro-app.oss-cn-beijing.aliyuncs.com/vue3.jpeg",
          "title": "计算机组成原理+操作系统+计算机网络"
        },
        {
          "imgUrl": "https://imooc-micro-app.oss-cn-beijing.aliyuncs.com/wiki.jpeg",
          "title": "Vue2.5 开发去哪儿网App"
        },
        {
          "imgUrl": "https://imooc-micro-app.oss-cn-beijing.aliyuncs.com/TS.jpeg",
          "title": "Spark Streaming"
        },
        {
          "imgUrl": "https://imooc-micro-app.oss-cn-beijing.aliyuncs.com/css.jpeg",
          "title": "剑指Java面试-Offer直通车"
        },
        {
          "imgUrl": "https://imooc-micro-app.oss-cn-beijing.aliyuncs.com/framework.jpeg",
          "title": "前端性能优化--6大角度综合型优化方案"
        }
      ],
      "pathMonth": [
        {
          "imgUrl": "https://imooc-micro-app.oss-cn-beijing.aliyuncs.com/graduate.jpeg",
          "title": "Vue2.5 开发去哪儿网App"
        },
        {
          "imgUrl": "https://imooc-micro-app.oss-cn-beijing.aliyuncs.com/graduate.jpeg",
          "title": "计算机组成原理+操作系统+计算机网络"
        },
        {
          "imgUrl": "https://imooc-micro-app.oss-cn-beijing.aliyuncs.com/ko2.jpeg",
          "title": "Spark Streaming"
        },
        {
          "imgUrl": "https://imooc-micro-app.oss-cn-beijing.aliyuncs.com/micro.jpeg",
          "title": "剑指Java面试-Offer直通车"
        },
        {
          "imgUrl": "https://imooc-micro-app.oss-cn-beijing.aliyuncs.com/react.jpeg",
          "title": "前端性能优化--6大角度综合型优化方案"
        }
      ]
    }

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.changeList(this.data.tagType,this.data.timeType)
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})